Initial commit

This commit is contained in:
2026-07-03 16:37:12 +07:00
commit 63b8c1ea8b
1931 changed files with 640587 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace RobotNet10.FleetManager.Data
{
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : IdentityDbContext<ApplicationUser>(options)
{
/// <summary>
/// Robot models
/// </summary>
public DbSet<RobotModel> RobotModels { get; set; }
/// <summary>
/// Robots
/// </summary>
public DbSet<Robot> Robots { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Configure RobotModel
modelBuilder.Entity<RobotModel>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.ModelName).HasDatabaseName("IX_RobotModels_ModelName");
entity.HasIndex(e => e.NavigationType).HasDatabaseName("IX_RobotModels_NavigationType");
entity.HasIndex(e => e.VehicleTypeId).HasDatabaseName("IX_RobotModels_VehicleTypeId");
entity.Property(e => e.ModelName).IsRequired().HasMaxLength(256);
entity.Property(e => e.Length).HasPrecision(18, 2);
entity.Property(e => e.Width).HasPrecision(18, 2);
entity.Property(e => e.NavigationPointX).HasPrecision(18, 2);
entity.Property(e => e.NavigationPointY).HasPrecision(18, 2);
entity.Property(e => e.CreatedDate).IsRequired();
});
// Configure Robot
modelBuilder.Entity<Robot>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.RobotId).IsUnique().HasDatabaseName("UX_Robots_RobotId");
entity.HasIndex(e => e.ModelId).HasDatabaseName("IX_Robots_ModelId");
entity.HasIndex(e => e.MapId).HasDatabaseName("IX_Robots_MapId");
entity.Property(e => e.RobotId).IsRequired().HasMaxLength(64);
entity.Property(e => e.Name).IsRequired().HasMaxLength(256);
entity.Property(e => e.ModelId).IsRequired();
entity.Property(e => e.CreatedDate).IsRequired();
// Foreign key relationship
entity.HasOne(e => e.Model)
.WithMany(m => m.Robots)
.HasForeignKey(e => e.ModelId)
.OnDelete(DeleteBehavior.Restrict);
});
}
}
}

View File

@@ -0,0 +1,105 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
namespace RobotNet10.FleetManager.Data;
public static class ApplicationDbExtensions
{
extension(IServiceProvider serviceProvider)
{
public async Task SeedApplicationDbAsync()
{
using var scope = serviceProvider.CreateScope();
using var appDb = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
await appDb.Database.MigrateAsync();
await appDb.Database.EnsureCreatedAsync();
await appDb.SaveChangesAsync();
await scope.ServiceProvider.SeedRolesAsync();
await scope.ServiceProvider.SeedUsersAsync();
}
private async Task SeedRolesAsync()
{
var roleManager = serviceProvider.GetRequiredService<RoleManager<IdentityRole>>();
if (!await roleManager.RoleExistsAsync("Administrator"))
{
await roleManager.CreateAsync(new IdentityRole()
{
Name = "Administrator",
NormalizedName = "ADMINISTRATOR",
});
}
if (!await roleManager.RoleExistsAsync("Distributor"))
{
await roleManager.CreateAsync(new IdentityRole()
{
Name = "Distributor",
NormalizedName = "DISTRIBUTOR",
});
}
if (!await roleManager.RoleExistsAsync("Operator"))
{
await roleManager.CreateAsync(new IdentityRole()
{
Name = "Operator",
NormalizedName = "OPERATOR",
});
}
}
private async Task SeedUsersAsync()
{
using var userManager = serviceProvider.GetRequiredService<UserManager<ApplicationUser>>();
if (await userManager.FindByNameAsync("admin") is null)
{
var admin = new ApplicationUser()
{
UserName = "admin",
Email = "administrator@phenikaa-x.com",
NormalizedUserName = "ADMINISTRATOR",
NormalizedEmail = "ADMINISTRATOR@PHENIKAA-X.COM",
EmailConfirmed = true,
};
await userManager.CreateAsync(admin, "robotics");
await userManager.AddToRoleAsync(admin, "Administrator");
}
if (await userManager.FindByNameAsync("distributor") is null)
{
var admin = new ApplicationUser()
{
UserName = "distributor",
Email = "distributor@phenikaa-x.com",
NormalizedUserName = "DISTRIBUTOR",
NormalizedEmail = "DISTRIBUTOR@PHENIKAA-X.COM",
EmailConfirmed = true,
};
await userManager.CreateAsync(admin, "distributor");
await userManager.AddToRoleAsync(admin, "Distributor");
}
if (await userManager.FindByNameAsync("Operator") is null)
{
var admin = new ApplicationUser()
{
UserName = "Operator",
Email = "Operator@phenikaa-x.com",
NormalizedUserName = "OPERATOR",
NormalizedEmail = "OPERATOR@PHENIKAA-X.COM",
EmailConfirmed = true,
};
await userManager.CreateAsync(admin, "Operator");
await userManager.AddToRoleAsync(admin, "Operator");
}
}
}
}

View File

@@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Identity;
namespace RobotNet10.FleetManager.Data
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
}
}

View File

@@ -0,0 +1,397 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RobotNet10.FleetManager.Data;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.AppDb
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260209025755_AddAppDb")]
partial class AddAppDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.Robot", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<Guid?>("MapId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("ModelId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("RobotId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime?>("UpdatedDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("MapId")
.HasDatabaseName("IX_Robots_MapId");
b.HasIndex("ModelId")
.HasDatabaseName("IX_Robots_ModelId");
b.HasIndex("RobotId")
.IsUnique()
.HasDatabaseName("UX_Robots_RobotId");
b.ToTable("Robots");
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.RobotModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<int>("ImageHeight")
.HasColumnType("int");
b.Property<int>("ImageWidth")
.HasColumnType("int");
b.Property<double>("Length")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.Property<string>("ModelName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<double>("NavigationPointX")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.Property<double>("NavigationPointY")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.Property<int>("NavigationType")
.HasColumnType("int");
b.Property<DateTime?>("UpdatedDate")
.HasColumnType("datetime2");
b.Property<Guid?>("VehicleTypeId")
.HasColumnType("uniqueidentifier");
b.Property<double>("Width")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.HasKey("Id");
b.HasIndex("ModelName")
.HasDatabaseName("IX_RobotModels_ModelName");
b.HasIndex("NavigationType")
.HasDatabaseName("IX_RobotModels_NavigationType");
b.HasIndex("VehicleTypeId")
.HasDatabaseName("IX_RobotModels_VehicleTypeId");
b.ToTable("RobotModels");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.Robot", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.RobotModel", "Model")
.WithMany("Robots")
.HasForeignKey("ModelId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Model");
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.RobotModel", b =>
{
b.Navigation("Robots");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,306 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.AppDb
{
/// <inheritdoc />
public partial class AddAppDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RobotModels",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModelName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Length = table.Column<double>(type: "float(18)", precision: 18, scale: 2, nullable: false),
Width = table.Column<double>(type: "float(18)", precision: 18, scale: 2, nullable: false),
ImageWidth = table.Column<int>(type: "int", nullable: false),
ImageHeight = table.Column<int>(type: "int", nullable: false),
NavigationPointX = table.Column<double>(type: "float(18)", precision: 18, scale: 2, nullable: false),
NavigationPointY = table.Column<double>(type: "float(18)", precision: 18, scale: 2, nullable: false),
NavigationType = table.Column<int>(type: "int", nullable: false),
VehicleTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdatedDate = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RobotModels", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Robots",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RobotId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
ModelId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MapId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
UpdatedDate = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Robots", x => x.Id);
table.ForeignKey(
name: "FK_Robots_RobotModels_ModelId",
column: x => x.ModelId,
principalTable: "RobotModels",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true,
filter: "[NormalizedName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserLogins_UserId",
table: "AspNetUserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true,
filter: "[NormalizedUserName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_RobotModels_ModelName",
table: "RobotModels",
column: "ModelName");
migrationBuilder.CreateIndex(
name: "IX_RobotModels_NavigationType",
table: "RobotModels",
column: "NavigationType");
migrationBuilder.CreateIndex(
name: "IX_RobotModels_VehicleTypeId",
table: "RobotModels",
column: "VehicleTypeId");
migrationBuilder.CreateIndex(
name: "IX_Robots_MapId",
table: "Robots",
column: "MapId");
migrationBuilder.CreateIndex(
name: "IX_Robots_ModelId",
table: "Robots",
column: "ModelId");
migrationBuilder.CreateIndex(
name: "UX_Robots_RobotId",
table: "Robots",
column: "RobotId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "Robots");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "AspNetUsers");
migrationBuilder.DropTable(
name: "RobotModels");
}
}
}

View File

@@ -0,0 +1,394 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RobotNet10.FleetManager.Data;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.AppDb
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.Robot", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<Guid?>("MapId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("ModelId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("RobotId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime?>("UpdatedDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("MapId")
.HasDatabaseName("IX_Robots_MapId");
b.HasIndex("ModelId")
.HasDatabaseName("IX_Robots_ModelId");
b.HasIndex("RobotId")
.IsUnique()
.HasDatabaseName("UX_Robots_RobotId");
b.ToTable("Robots");
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.RobotModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<int>("ImageHeight")
.HasColumnType("int");
b.Property<int>("ImageWidth")
.HasColumnType("int");
b.Property<double>("Length")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.Property<string>("ModelName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<double>("NavigationPointX")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.Property<double>("NavigationPointY")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.Property<int>("NavigationType")
.HasColumnType("int");
b.Property<DateTime?>("UpdatedDate")
.HasColumnType("datetime2");
b.Property<Guid?>("VehicleTypeId")
.HasColumnType("uniqueidentifier");
b.Property<double>("Width")
.HasPrecision(18, 2)
.HasColumnType("float(18)");
b.HasKey("Id");
b.HasIndex("ModelName")
.HasDatabaseName("IX_RobotModels_ModelName");
b.HasIndex("NavigationType")
.HasDatabaseName("IX_RobotModels_NavigationType");
b.HasIndex("VehicleTypeId")
.HasDatabaseName("IX_RobotModels_VehicleTypeId");
b.ToTable("RobotModels");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.Robot", b =>
{
b.HasOne("RobotNet10.FleetManager.Data.RobotModel", "Model")
.WithMany("Robots")
.HasForeignKey("ModelId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Model");
});
modelBuilder.Entity("RobotNet10.FleetManager.Data.RobotModel", b =>
{
b.Navigation("Robots");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,710 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RobotNet10.MapManager.Data;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.MapDb
{
[DbContext(typeof(MapDbContext))]
[Migration("20260305070805_AddMapDb")]
partial class AddMapDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("RobotNet10.MapManager.Data.Edge", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("EdgeDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("EdgeId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("EdgeName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<Guid>("EndNodeId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("StartNodeId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("EdgeId");
b.HasIndex("EndNodeId");
b.HasIndex("StartNodeId");
b.HasIndex("LevelId", "EdgeId")
.IsUnique();
b.ToTable("Edges", t =>
{
t.HasCheckConstraint("CK_Edges_DifferentNodes", "[StartNodeId] <> [EndNodeId]");
});
});
modelBuilder.Entity("RobotNet10.MapManager.Data.EdgeVehicleProperty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Actions")
.HasColumnType("nvarchar(max)");
b.Property<double?>("CorridorLeftWidth")
.HasColumnType("float");
b.Property<int?>("CorridorRefPoint")
.HasColumnType("int");
b.Property<double?>("CorridorRightWidth")
.HasColumnType("float");
b.Property<Guid>("EdgeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("LoadRestriction_LoadSetNames")
.HasColumnType("nvarchar(max)");
b.Property<bool?>("LoadRestriction_Loaded")
.HasColumnType("bit");
b.Property<bool?>("LoadRestriction_Unloaded")
.HasColumnType("bit");
b.Property<double?>("MaxHeight")
.HasColumnType("float");
b.Property<double?>("MaxRotationSpeed")
.HasColumnType("float");
b.Property<double?>("MaxSpeed")
.HasColumnType("float");
b.Property<double?>("MinHeight")
.HasColumnType("float");
b.Property<int?>("OrientationType")
.HasColumnType("int");
b.Property<bool?>("RotationAllowed")
.HasColumnType("bit");
b.Property<int?>("RotationAtEndNodeAllowed")
.HasColumnType("int");
b.Property<int?>("RotationAtStartNodeAllowed")
.HasColumnType("int");
b.Property<double?>("TrajectoryControlPoint1X")
.HasColumnType("float");
b.Property<double?>("TrajectoryControlPoint1Y")
.HasColumnType("float");
b.Property<double?>("TrajectoryControlPoint2X")
.HasColumnType("float");
b.Property<double?>("TrajectoryControlPoint2Y")
.HasColumnType("float");
b.Property<int?>("TrajectoryDegree")
.HasColumnType("int");
b.Property<double?>("VehicleOrientation")
.HasColumnType("float");
b.Property<Guid>("VehicleTypeId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("EdgeId");
b.HasIndex("VehicleTypeId");
b.HasIndex("EdgeId", "VehicleTypeId")
.IsUnique();
b.ToTable("EdgeVehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Layout", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("CreatedBy")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LayoutId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("LayoutName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ModifiedBy")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime>("ModifiedDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("LayoutId")
.IsUnique();
b.ToTable("Layouts");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("LayoutLevelId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("LevelOrder")
.HasColumnType("int");
b.Property<Guid>("VersionId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("LevelOrder");
b.HasIndex("VersionId", "LayoutLevelId")
.IsUnique();
b.ToTable("LayoutLevels");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevelEditorSettings", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<double?>("BoundsMaxX")
.HasColumnType("float");
b.Property<double?>("BoundsMaxY")
.HasColumnType("float");
b.Property<double?>("BoundsMinX")
.HasColumnType("float");
b.Property<double?>("BoundsMinY")
.HasColumnType("float");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<double>("EdgeMinLengthCreate")
.HasColumnType("float");
b.Property<bool>("EdgeNameAutoGenerate")
.HasColumnType("bit");
b.Property<double?>("ImageHeight")
.HasColumnType("float");
b.Property<double?>("ImageWidth")
.HasColumnType("float");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ModifiedDate")
.HasColumnType("datetime2");
b.Property<bool>("NodeNameAutoGenerate")
.HasColumnType("bit");
b.Property<double>("NodeProximityRadius")
.HasColumnType("float");
b.Property<double>("OriginX")
.HasColumnType("float");
b.Property<double>("OriginY")
.HasColumnType("float");
b.Property<double>("Resolution")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("LevelId")
.IsUnique();
b.ToTable("LayoutLevelEditorSettings");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutVersion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("CreatedBy")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LayoutDescription")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("LayoutId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Version")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("LayoutId", "Version")
.IsUnique();
b.ToTable("LayoutVersions");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Node", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<string>("MapId")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("NodeDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("NodeId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("NodeName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<double>("X")
.HasColumnType("float");
b.Property<double>("Y")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("MapId");
b.HasIndex("NodeId");
b.HasIndex("LevelId", "NodeId")
.IsUnique();
b.HasIndex("X", "Y");
b.ToTable("Nodes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.NodeVehicleProperty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Actions")
.HasColumnType("nvarchar(max)");
b.Property<double?>("AllowedDeviationTheta")
.HasColumnType("float");
b.Property<double?>("AllowedDeviationXY")
.HasColumnType("float");
b.Property<Guid>("NodeId")
.HasColumnType("uniqueidentifier");
b.Property<double?>("Theta")
.HasColumnType("float");
b.Property<Guid>("VehicleTypeId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("NodeId");
b.HasIndex("VehicleTypeId");
b.HasIndex("NodeId", "VehicleTypeId")
.IsUnique();
b.ToTable("NodeVehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Station", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<string>("StationDescription")
.HasColumnType("nvarchar(max)");
b.Property<double?>("StationHeight")
.HasColumnType("float");
b.Property<string>("StationId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("StationName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<double?>("Theta")
.HasColumnType("float");
b.Property<double>("X")
.HasColumnType("float");
b.Property<double>("Y")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("StationId");
b.HasIndex("LevelId", "StationId")
.IsUnique();
b.ToTable("Stations");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.StationInteractionNode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("NodeId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("StationId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("NodeId");
b.HasIndex("StationId");
b.HasIndex("StationId", "NodeId")
.IsUnique();
b.ToTable("StationInteractionNodes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.VehicleType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Actions")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("Specifications")
.HasColumnType("nvarchar(max)");
b.Property<string>("VehicleTypeId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("VehicleTypeName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("VehicleTypeId")
.IsUnique();
b.ToTable("VehicleTypes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Edge", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Node", "EndNode")
.WithMany("IncomingEdges")
.HasForeignKey("EndNodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithMany("Edges")
.HasForeignKey("LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.Node", "StartNode")
.WithMany("OutgoingEdges")
.HasForeignKey("StartNodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("EndNode");
b.Navigation("Level");
b.Navigation("StartNode");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.EdgeVehicleProperty", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Edge", "Edge")
.WithMany("VehicleProperties")
.HasForeignKey("EdgeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.VehicleType", "VehicleType")
.WithMany("EdgeVehicleProperties")
.HasForeignKey("VehicleTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Edge");
b.Navigation("VehicleType");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevel", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutVersion", "Version")
.WithMany("Levels")
.HasForeignKey("VersionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Version");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevelEditorSettings", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithOne("EditorSettings")
.HasForeignKey("RobotNet10.MapManager.Data.LayoutLevelEditorSettings", "LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Level");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutVersion", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Layout", "Layout")
.WithMany("Versions")
.HasForeignKey("LayoutId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Layout");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Node", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithMany("Nodes")
.HasForeignKey("LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Level");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.NodeVehicleProperty", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Node", "Node")
.WithMany("VehicleProperties")
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.VehicleType", "VehicleType")
.WithMany("NodeVehicleProperties")
.HasForeignKey("VehicleTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Node");
b.Navigation("VehicleType");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Station", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithMany("Stations")
.HasForeignKey("LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Level");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.StationInteractionNode", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Node", "Node")
.WithMany("StationInteractions")
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.Station", "Station")
.WithMany("InteractionNodes")
.HasForeignKey("StationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Node");
b.Navigation("Station");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Edge", b =>
{
b.Navigation("VehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Layout", b =>
{
b.Navigation("Versions");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevel", b =>
{
b.Navigation("Edges");
b.Navigation("EditorSettings");
b.Navigation("Nodes");
b.Navigation("Stations");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutVersion", b =>
{
b.Navigation("Levels");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Node", b =>
{
b.Navigation("IncomingEdges");
b.Navigation("OutgoingEdges");
b.Navigation("StationInteractions");
b.Navigation("VehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Station", b =>
{
b.Navigation("InteractionNodes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.VehicleType", b =>
{
b.Navigation("EdgeVehicleProperties");
b.Navigation("NodeVehicleProperties");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,501 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.MapDb
{
/// <inheritdoc />
public partial class AddMapDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Layouts",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LayoutId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
LayoutName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ModifiedBy = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Layouts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "VehicleTypes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
VehicleTypeId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
VehicleTypeName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Specifications = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false),
Actions = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VehicleTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LayoutVersions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LayoutId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Version = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
LayoutDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedBy = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LayoutVersions", x => x.Id);
table.ForeignKey(
name: "FK_LayoutVersions_Layouts_LayoutId",
column: x => x.LayoutId,
principalTable: "Layouts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LayoutLevels",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
VersionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LayoutLevelId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
LevelOrder = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LayoutLevels", x => x.Id);
table.ForeignKey(
name: "FK_LayoutLevels_LayoutVersions_VersionId",
column: x => x.VersionId,
principalTable: "LayoutVersions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LayoutLevelEditorSettings",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LevelId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EdgeMinLengthCreate = table.Column<double>(type: "float", nullable: false),
EdgeNameAutoGenerate = table.Column<bool>(type: "bit", nullable: false),
NodeNameAutoGenerate = table.Column<bool>(type: "bit", nullable: false),
NodeProximityRadius = table.Column<double>(type: "float", nullable: false),
OriginX = table.Column<double>(type: "float", nullable: false),
OriginY = table.Column<double>(type: "float", nullable: false),
Resolution = table.Column<double>(type: "float", nullable: false),
BoundsMinX = table.Column<double>(type: "float", nullable: true),
BoundsMaxX = table.Column<double>(type: "float", nullable: true),
BoundsMinY = table.Column<double>(type: "float", nullable: true),
BoundsMaxY = table.Column<double>(type: "float", nullable: true),
ImageWidth = table.Column<double>(type: "float", nullable: true),
ImageHeight = table.Column<double>(type: "float", nullable: true),
CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LayoutLevelEditorSettings", x => x.Id);
table.ForeignKey(
name: "FK_LayoutLevelEditorSettings_LayoutLevels_LevelId",
column: x => x.LevelId,
principalTable: "LayoutLevels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Nodes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LevelId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NodeId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
NodeName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NodeDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
MapId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
X = table.Column<double>(type: "float", nullable: false),
Y = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Nodes", x => x.Id);
table.ForeignKey(
name: "FK_Nodes_LayoutLevels_LevelId",
column: x => x.LevelId,
principalTable: "LayoutLevels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Stations",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LevelId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StationId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
StationName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
StationDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
StationHeight = table.Column<double>(type: "float", nullable: true),
X = table.Column<double>(type: "float", nullable: false),
Y = table.Column<double>(type: "float", nullable: false),
Theta = table.Column<double>(type: "float", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Stations", x => x.Id);
table.ForeignKey(
name: "FK_Stations_LayoutLevels_LevelId",
column: x => x.LevelId,
principalTable: "LayoutLevels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Edges",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LevelId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EdgeId = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
StartNodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EndNodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EdgeName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
EdgeDescription = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Edges", x => x.Id);
table.CheckConstraint("CK_Edges_DifferentNodes", "[StartNodeId] <> [EndNodeId]");
table.ForeignKey(
name: "FK_Edges_LayoutLevels_LevelId",
column: x => x.LevelId,
principalTable: "LayoutLevels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Edges_Nodes_EndNodeId",
column: x => x.EndNodeId,
principalTable: "Nodes",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Edges_Nodes_StartNodeId",
column: x => x.StartNodeId,
principalTable: "Nodes",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "NodeVehicleProperties",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
VehicleTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Theta = table.Column<double>(type: "float", nullable: true),
Actions = table.Column<string>(type: "nvarchar(max)", nullable: true),
AllowedDeviationXY = table.Column<double>(type: "float", nullable: true),
AllowedDeviationTheta = table.Column<double>(type: "float", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_NodeVehicleProperties", x => x.Id);
table.ForeignKey(
name: "FK_NodeVehicleProperties_Nodes_NodeId",
column: x => x.NodeId,
principalTable: "Nodes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_NodeVehicleProperties_VehicleTypes_VehicleTypeId",
column: x => x.VehicleTypeId,
principalTable: "VehicleTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "StationInteractionNodes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StationId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NodeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StationInteractionNodes", x => x.Id);
table.ForeignKey(
name: "FK_StationInteractionNodes_Nodes_NodeId",
column: x => x.NodeId,
principalTable: "Nodes",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_StationInteractionNodes_Stations_StationId",
column: x => x.StationId,
principalTable: "Stations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EdgeVehicleProperties",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EdgeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
VehicleTypeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
VehicleOrientation = table.Column<double>(type: "float", nullable: true),
OrientationType = table.Column<int>(type: "int", nullable: true),
RotationAllowed = table.Column<bool>(type: "bit", nullable: true),
RotationAtStartNodeAllowed = table.Column<int>(type: "int", nullable: true),
RotationAtEndNodeAllowed = table.Column<int>(type: "int", nullable: true),
MaxSpeed = table.Column<double>(type: "float", nullable: true),
MaxRotationSpeed = table.Column<double>(type: "float", nullable: true),
MinHeight = table.Column<double>(type: "float", nullable: true),
MaxHeight = table.Column<double>(type: "float", nullable: true),
LoadRestriction_Unloaded = table.Column<bool>(type: "bit", nullable: true),
LoadRestriction_Loaded = table.Column<bool>(type: "bit", nullable: true),
LoadRestriction_LoadSetNames = table.Column<string>(type: "nvarchar(max)", nullable: true),
TrajectoryDegree = table.Column<int>(type: "int", nullable: true),
TrajectoryControlPoint1X = table.Column<double>(type: "float", nullable: true),
TrajectoryControlPoint1Y = table.Column<double>(type: "float", nullable: true),
TrajectoryControlPoint2X = table.Column<double>(type: "float", nullable: true),
TrajectoryControlPoint2Y = table.Column<double>(type: "float", nullable: true),
Actions = table.Column<string>(type: "nvarchar(max)", nullable: true),
CorridorLeftWidth = table.Column<double>(type: "float", nullable: true),
CorridorRightWidth = table.Column<double>(type: "float", nullable: true),
CorridorRefPoint = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EdgeVehicleProperties", x => x.Id);
table.ForeignKey(
name: "FK_EdgeVehicleProperties_Edges_EdgeId",
column: x => x.EdgeId,
principalTable: "Edges",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EdgeVehicleProperties_VehicleTypes_VehicleTypeId",
column: x => x.VehicleTypeId,
principalTable: "VehicleTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Edges_EdgeId",
table: "Edges",
column: "EdgeId");
migrationBuilder.CreateIndex(
name: "IX_Edges_EndNodeId",
table: "Edges",
column: "EndNodeId");
migrationBuilder.CreateIndex(
name: "IX_Edges_LevelId_EdgeId",
table: "Edges",
columns: new[] { "LevelId", "EdgeId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Edges_StartNodeId",
table: "Edges",
column: "StartNodeId");
migrationBuilder.CreateIndex(
name: "IX_EdgeVehicleProperties_EdgeId",
table: "EdgeVehicleProperties",
column: "EdgeId");
migrationBuilder.CreateIndex(
name: "IX_EdgeVehicleProperties_EdgeId_VehicleTypeId",
table: "EdgeVehicleProperties",
columns: new[] { "EdgeId", "VehicleTypeId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_EdgeVehicleProperties_VehicleTypeId",
table: "EdgeVehicleProperties",
column: "VehicleTypeId");
migrationBuilder.CreateIndex(
name: "IX_LayoutLevelEditorSettings_LevelId",
table: "LayoutLevelEditorSettings",
column: "LevelId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LayoutLevels_LevelOrder",
table: "LayoutLevels",
column: "LevelOrder");
migrationBuilder.CreateIndex(
name: "IX_LayoutLevels_VersionId_LayoutLevelId",
table: "LayoutLevels",
columns: new[] { "VersionId", "LayoutLevelId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Layouts_IsActive",
table: "Layouts",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_Layouts_LayoutId",
table: "Layouts",
column: "LayoutId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LayoutVersions_IsActive",
table: "LayoutVersions",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_LayoutVersions_LayoutId_Version",
table: "LayoutVersions",
columns: new[] { "LayoutId", "Version" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Nodes_LevelId_NodeId",
table: "Nodes",
columns: new[] { "LevelId", "NodeId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Nodes_MapId",
table: "Nodes",
column: "MapId");
migrationBuilder.CreateIndex(
name: "IX_Nodes_NodeId",
table: "Nodes",
column: "NodeId");
migrationBuilder.CreateIndex(
name: "IX_Nodes_X_Y",
table: "Nodes",
columns: new[] { "X", "Y" });
migrationBuilder.CreateIndex(
name: "IX_NodeVehicleProperties_NodeId",
table: "NodeVehicleProperties",
column: "NodeId");
migrationBuilder.CreateIndex(
name: "IX_NodeVehicleProperties_NodeId_VehicleTypeId",
table: "NodeVehicleProperties",
columns: new[] { "NodeId", "VehicleTypeId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_NodeVehicleProperties_VehicleTypeId",
table: "NodeVehicleProperties",
column: "VehicleTypeId");
migrationBuilder.CreateIndex(
name: "IX_StationInteractionNodes_NodeId",
table: "StationInteractionNodes",
column: "NodeId");
migrationBuilder.CreateIndex(
name: "IX_StationInteractionNodes_StationId",
table: "StationInteractionNodes",
column: "StationId");
migrationBuilder.CreateIndex(
name: "IX_StationInteractionNodes_StationId_NodeId",
table: "StationInteractionNodes",
columns: new[] { "StationId", "NodeId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Stations_LevelId_StationId",
table: "Stations",
columns: new[] { "LevelId", "StationId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Stations_StationId",
table: "Stations",
column: "StationId");
migrationBuilder.CreateIndex(
name: "IX_VehicleTypes_IsActive",
table: "VehicleTypes",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_VehicleTypes_VehicleTypeId",
table: "VehicleTypes",
column: "VehicleTypeId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EdgeVehicleProperties");
migrationBuilder.DropTable(
name: "LayoutLevelEditorSettings");
migrationBuilder.DropTable(
name: "NodeVehicleProperties");
migrationBuilder.DropTable(
name: "StationInteractionNodes");
migrationBuilder.DropTable(
name: "Edges");
migrationBuilder.DropTable(
name: "VehicleTypes");
migrationBuilder.DropTable(
name: "Stations");
migrationBuilder.DropTable(
name: "Nodes");
migrationBuilder.DropTable(
name: "LayoutLevels");
migrationBuilder.DropTable(
name: "LayoutVersions");
migrationBuilder.DropTable(
name: "Layouts");
}
}
}

View File

@@ -0,0 +1,707 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RobotNet10.MapManager.Data;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.MapDb
{
[DbContext(typeof(MapDbContext))]
partial class MapDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("RobotNet10.MapManager.Data.Edge", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("EdgeDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("EdgeId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("EdgeName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<Guid>("EndNodeId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("StartNodeId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("EdgeId");
b.HasIndex("EndNodeId");
b.HasIndex("StartNodeId");
b.HasIndex("LevelId", "EdgeId")
.IsUnique();
b.ToTable("Edges", t =>
{
t.HasCheckConstraint("CK_Edges_DifferentNodes", "[StartNodeId] <> [EndNodeId]");
});
});
modelBuilder.Entity("RobotNet10.MapManager.Data.EdgeVehicleProperty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Actions")
.HasColumnType("nvarchar(max)");
b.Property<double?>("CorridorLeftWidth")
.HasColumnType("float");
b.Property<int?>("CorridorRefPoint")
.HasColumnType("int");
b.Property<double?>("CorridorRightWidth")
.HasColumnType("float");
b.Property<Guid>("EdgeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("LoadRestriction_LoadSetNames")
.HasColumnType("nvarchar(max)");
b.Property<bool?>("LoadRestriction_Loaded")
.HasColumnType("bit");
b.Property<bool?>("LoadRestriction_Unloaded")
.HasColumnType("bit");
b.Property<double?>("MaxHeight")
.HasColumnType("float");
b.Property<double?>("MaxRotationSpeed")
.HasColumnType("float");
b.Property<double?>("MaxSpeed")
.HasColumnType("float");
b.Property<double?>("MinHeight")
.HasColumnType("float");
b.Property<int?>("OrientationType")
.HasColumnType("int");
b.Property<bool?>("RotationAllowed")
.HasColumnType("bit");
b.Property<int?>("RotationAtEndNodeAllowed")
.HasColumnType("int");
b.Property<int?>("RotationAtStartNodeAllowed")
.HasColumnType("int");
b.Property<double?>("TrajectoryControlPoint1X")
.HasColumnType("float");
b.Property<double?>("TrajectoryControlPoint1Y")
.HasColumnType("float");
b.Property<double?>("TrajectoryControlPoint2X")
.HasColumnType("float");
b.Property<double?>("TrajectoryControlPoint2Y")
.HasColumnType("float");
b.Property<int?>("TrajectoryDegree")
.HasColumnType("int");
b.Property<double?>("VehicleOrientation")
.HasColumnType("float");
b.Property<Guid>("VehicleTypeId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("EdgeId");
b.HasIndex("VehicleTypeId");
b.HasIndex("EdgeId", "VehicleTypeId")
.IsUnique();
b.ToTable("EdgeVehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Layout", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("CreatedBy")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LayoutId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("LayoutName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ModifiedBy")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime>("ModifiedDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("LayoutId")
.IsUnique();
b.ToTable("Layouts");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("LayoutLevelId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("LevelOrder")
.HasColumnType("int");
b.Property<Guid>("VersionId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("LevelOrder");
b.HasIndex("VersionId", "LayoutLevelId")
.IsUnique();
b.ToTable("LayoutLevels");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevelEditorSettings", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<double?>("BoundsMaxX")
.HasColumnType("float");
b.Property<double?>("BoundsMaxY")
.HasColumnType("float");
b.Property<double?>("BoundsMinX")
.HasColumnType("float");
b.Property<double?>("BoundsMinY")
.HasColumnType("float");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<double>("EdgeMinLengthCreate")
.HasColumnType("float");
b.Property<bool>("EdgeNameAutoGenerate")
.HasColumnType("bit");
b.Property<double?>("ImageHeight")
.HasColumnType("float");
b.Property<double?>("ImageWidth")
.HasColumnType("float");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ModifiedDate")
.HasColumnType("datetime2");
b.Property<bool>("NodeNameAutoGenerate")
.HasColumnType("bit");
b.Property<double>("NodeProximityRadius")
.HasColumnType("float");
b.Property<double>("OriginX")
.HasColumnType("float");
b.Property<double>("OriginY")
.HasColumnType("float");
b.Property<double>("Resolution")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("LevelId")
.IsUnique();
b.ToTable("LayoutLevelEditorSettings");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutVersion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("CreatedBy")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LayoutDescription")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("LayoutId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Version")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("LayoutId", "Version")
.IsUnique();
b.ToTable("LayoutVersions");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Node", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<string>("MapId")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("NodeDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("NodeId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("NodeName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<double>("X")
.HasColumnType("float");
b.Property<double>("Y")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("MapId");
b.HasIndex("NodeId");
b.HasIndex("LevelId", "NodeId")
.IsUnique();
b.HasIndex("X", "Y");
b.ToTable("Nodes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.NodeVehicleProperty", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Actions")
.HasColumnType("nvarchar(max)");
b.Property<double?>("AllowedDeviationTheta")
.HasColumnType("float");
b.Property<double?>("AllowedDeviationXY")
.HasColumnType("float");
b.Property<Guid>("NodeId")
.HasColumnType("uniqueidentifier");
b.Property<double?>("Theta")
.HasColumnType("float");
b.Property<Guid>("VehicleTypeId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("NodeId");
b.HasIndex("VehicleTypeId");
b.HasIndex("NodeId", "VehicleTypeId")
.IsUnique();
b.ToTable("NodeVehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Station", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LevelId")
.HasColumnType("uniqueidentifier");
b.Property<string>("StationDescription")
.HasColumnType("nvarchar(max)");
b.Property<double?>("StationHeight")
.HasColumnType("float");
b.Property<string>("StationId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("StationName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<double?>("Theta")
.HasColumnType("float");
b.Property<double>("X")
.HasColumnType("float");
b.Property<double>("Y")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("StationId");
b.HasIndex("LevelId", "StationId")
.IsUnique();
b.ToTable("Stations");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.StationInteractionNode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("NodeId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("StationId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("NodeId");
b.HasIndex("StationId");
b.HasIndex("StationId", "NodeId")
.IsUnique();
b.ToTable("StationInteractionNodes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.VehicleType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Actions")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("Specifications")
.HasColumnType("nvarchar(max)");
b.Property<string>("VehicleTypeId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("VehicleTypeName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("IsActive");
b.HasIndex("VehicleTypeId")
.IsUnique();
b.ToTable("VehicleTypes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Edge", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Node", "EndNode")
.WithMany("IncomingEdges")
.HasForeignKey("EndNodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithMany("Edges")
.HasForeignKey("LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.Node", "StartNode")
.WithMany("OutgoingEdges")
.HasForeignKey("StartNodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("EndNode");
b.Navigation("Level");
b.Navigation("StartNode");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.EdgeVehicleProperty", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Edge", "Edge")
.WithMany("VehicleProperties")
.HasForeignKey("EdgeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.VehicleType", "VehicleType")
.WithMany("EdgeVehicleProperties")
.HasForeignKey("VehicleTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Edge");
b.Navigation("VehicleType");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevel", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutVersion", "Version")
.WithMany("Levels")
.HasForeignKey("VersionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Version");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevelEditorSettings", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithOne("EditorSettings")
.HasForeignKey("RobotNet10.MapManager.Data.LayoutLevelEditorSettings", "LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Level");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutVersion", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Layout", "Layout")
.WithMany("Versions")
.HasForeignKey("LayoutId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Layout");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Node", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithMany("Nodes")
.HasForeignKey("LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Level");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.NodeVehicleProperty", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Node", "Node")
.WithMany("VehicleProperties")
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.VehicleType", "VehicleType")
.WithMany("NodeVehicleProperties")
.HasForeignKey("VehicleTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Node");
b.Navigation("VehicleType");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Station", b =>
{
b.HasOne("RobotNet10.MapManager.Data.LayoutLevel", "Level")
.WithMany("Stations")
.HasForeignKey("LevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Level");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.StationInteractionNode", b =>
{
b.HasOne("RobotNet10.MapManager.Data.Node", "Node")
.WithMany("StationInteractions")
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("RobotNet10.MapManager.Data.Station", "Station")
.WithMany("InteractionNodes")
.HasForeignKey("StationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Node");
b.Navigation("Station");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Edge", b =>
{
b.Navigation("VehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Layout", b =>
{
b.Navigation("Versions");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutLevel", b =>
{
b.Navigation("Edges");
b.Navigation("EditorSettings");
b.Navigation("Nodes");
b.Navigation("Stations");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.LayoutVersion", b =>
{
b.Navigation("Levels");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Node", b =>
{
b.Navigation("IncomingEdges");
b.Navigation("OutgoingEdges");
b.Navigation("StationInteractions");
b.Navigation("VehicleProperties");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.Station", b =>
{
b.Navigation("InteractionNodes");
});
modelBuilder.Entity("RobotNet10.MapManager.Data.VehicleType", b =>
{
b.Navigation("EdgeVehicleProperties");
b.Navigation("NodeVehicleProperties");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,77 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RobotNet10.ScriptEngine.Data;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.ScriptDb
{
[DbContext(typeof(ScriptEngineDbContext))]
[Migration("20260209025906_AddScriptDb")]
partial class AddScriptDb
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("RobotNet10.ScriptEngine.Data.InstanceMission", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnName("Id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2")
.HasColumnName("CreatedAt");
b.Property<string>("Log")
.HasColumnType("nvarchar(max)")
.HasColumnName("Log");
b.Property<string>("MissionName")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("MissionName");
b.Property<string>("Parameters")
.HasColumnType("nvarchar(max)")
.HasColumnName("Parameters");
b.Property<int>("Score")
.HasColumnType("int")
.HasColumnName("Score");
b.Property<int>("State")
.HasColumnType("int")
.HasColumnName("State");
b.Property<DateTime>("StoppedAt")
.HasColumnType("datetime2")
.HasColumnName("StoppedAt");
b.Property<int>("TotalScore")
.HasColumnType("int")
.HasColumnName("TotalScore");
b.HasKey("Id");
b.HasIndex("CreatedAt");
b.ToTable("InstanceMissions");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,46 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.ScriptDb
{
/// <inheritdoc />
public partial class AddScriptDb : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InstanceMissions",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MissionName = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
Parameters = table.Column<string>(type: "nvarchar(max)", nullable: true),
TotalScore = table.Column<int>(type: "int", nullable: false),
State = table.Column<int>(type: "int", nullable: false),
Score = table.Column<int>(type: "int", nullable: false),
StoppedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
Log = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_InstanceMissions", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_InstanceMissions_CreatedAt",
table: "InstanceMissions",
column: "CreatedAt");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InstanceMissions");
}
}
}

View File

@@ -0,0 +1,74 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RobotNet10.ScriptEngine.Data;
#nullable disable
namespace RobotNet10.FleetManager.Data.Migrations.ScriptDb
{
[DbContext(typeof(ScriptEngineDbContext))]
partial class ScriptEngineDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("RobotNet10.ScriptEngine.Data.InstanceMission", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnName("Id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2")
.HasColumnName("CreatedAt");
b.Property<string>("Log")
.HasColumnType("nvarchar(max)")
.HasColumnName("Log");
b.Property<string>("MissionName")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnName("MissionName");
b.Property<string>("Parameters")
.HasColumnType("nvarchar(max)")
.HasColumnName("Parameters");
b.Property<int>("Score")
.HasColumnType("int")
.HasColumnName("Score");
b.Property<int>("State")
.HasColumnType("int")
.HasColumnName("State");
b.Property<DateTime>("StoppedAt")
.HasColumnType("datetime2")
.HasColumnName("StoppedAt");
b.Property<int>("TotalScore")
.HasColumnType("int")
.HasColumnName("TotalScore");
b.HasKey("Id");
b.HasIndex("CreatedAt");
b.ToTable("InstanceMissions");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,58 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RobotNet10.FleetManager.Data;
/// <summary>
/// Robot entity - Individual robot information
/// </summary>
[Table("Robots")]
public class Robot
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
/// <summary>
/// Robot identifier (serial number or unique identifier)
/// </summary>
[Required]
[StringLength(64)]
public string RobotId { get; set; } = string.Empty;
/// <summary>
/// Display name of the robot
/// </summary>
[Required]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
/// <summary>
/// Foreign key to RobotModel
/// </summary>
[Required]
public Guid ModelId { get; set; }
/// <summary>
/// Foreign key to Map (optional)
/// </summary>
public Guid? MapId { get; set; }
/// <summary>
/// Created date
/// </summary>
[Required]
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
/// <summary>
/// Updated date
/// </summary>
public DateTime? UpdatedDate { get; set; }
// Navigation properties
/// <summary>
/// Robot model this robot belongs to
/// </summary>
[ForeignKey(nameof(ModelId))]
public virtual RobotModel? Model { get; set; }
}

View File

@@ -0,0 +1,88 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using RobotNet10.FleetManager.Shared.Enums;
namespace RobotNet10.FleetManager.Data;
/// <summary>
/// Robot model entity - Master data for robot types
/// </summary>
[Table("RobotModels")]
public class RobotModel
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
/// <summary>
/// Model name
/// </summary>
[Required]
[StringLength(256)]
public string ModelName { get; set; } = string.Empty;
/// <summary>
/// Robot length in meters
/// </summary>
[Required]
public double Length { get; set; }
/// <summary>
/// Robot width in meters
/// </summary>
[Required]
public double Width { get; set; }
/// <summary>
/// Image width in pixels
/// </summary>
[Required]
public int ImageWidth { get; set; }
/// <summary>
/// Image height in pixels
/// </summary>
[Required]
public int ImageHeight { get; set; }
/// <summary>
/// Navigation point X coordinate (relative to robot center) in meters
/// </summary>
[Required]
public double NavigationPointX { get; set; }
/// <summary>
/// Navigation point Y coordinate (relative to robot center) in meters
/// </summary>
[Required]
public double NavigationPointY { get; set; }
/// <summary>
/// Navigation type
/// </summary>
[Required]
public NavigationType NavigationType { get; set; }
/// <summary>
/// Foreign key to VehicleType (in MapManager database)
/// Links RobotModel to VehicleType for map filtering
/// </summary>
public Guid? VehicleTypeId { get; set; }
/// <summary>
/// Created date
/// </summary>
[Required]
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
/// <summary>
/// Updated date
/// </summary>
public DateTime? UpdatedDate { get; set; }
// Navigation properties
/// <summary>
/// Collection of robots using this model
/// </summary>
public virtual ICollection<Robot> Robots { get; set; } = [];
}